define(function(require, exports, module){
	var $        = require("jquery");
	var util     = require('util');
	var pubjs    = require('pubjs');
	var view     = require('@base/view');

	var Base = view.container.extend({
		init: function(config){
			config = pubjs.conf(config,{

			});
			this.Super('init', arguments);
		},
		afterBuild: function(){
			var self = this;
			var el = this.getDOM();
			var c = this.getConfig();
			this.append($([
				'<div class="M-formHead">',
					'<span pub-name = "addButton" pub-mod = "@base/common/drop.add" class = "ml10"></span>',
				'</div>',
				'<div pub-name = "highGrid" pub-mod = "admin/messageMonitor/grid/grid.base"><div>'
				].join(''))
			);

			var config = {
				'addButton': {
					'def': LANG('新建监控设置'),
					'href': '#admin/smartMonitor/edit',
					'href_target': '_self'
				}
			}
			this.buildFromTemplate(config);

			self.createAsync('slotSidebar', '@layout/v1/sidebar.base', {
				'target': c.targetSidebar,
				'height': 270,
				'items': [
					{'name': 'dimType', 'uri':'modules/sideBarBase.radio', 'config': {
						'title': LANG('监控维度：'),
						'data': [
							{id: 0, name: LANG('所有')},
							{id: 1, name: LANG('推广组')},
							{id: 2, name: LANG('广告位')}
						],
						'value': 0
					}},
					// {'name': 'method', 'uri':'modules/sideBarBase.radio', 'config': {
					// 	'title': LANG('操作类型：'),
					// 	'data': [
					// 		{id: 0, name: LANG('所有')},
					// 		{id: 1, name: LANG('发邮件')},
					// 		{id: 2, name: LANG('推广组暂停')}
					// 	],
					// 	'value': 0
					// }},
					// {
					// 	'name': 'adver',
					//  	'uri': 'modules/sideBarBase.aderGridGroup',
					// 	'config':{
					// 		'url': 'qualification/list',
					// 		'title': LANG('广告主：')
					// 	}
					// }
				]
			});
		},
		onSidebarFilter: function(ev){
			var self = this
				,param = {};

			util.each(ev.param, function(item, idx){
				var type = idx;
				var id = item.id;

				switch (type) {
					case 'dimType':
						param.DimType = +id;
						break;
					case 'method':
						param.Method = +id;
						break;
					case 'adver':
						param.AdvertiserId = [];
						util.each(item.data,function(item){
							param.AdvertiserId.push(item);
						})
						break;
				}
			});
			self.$.highGrid.reload(param);
		},
		reload: function(){

		},
	});
	exports.main = Base;
});